package com.my.xl.salary.billdemo.dao;

import com.my.xl.salary.billdemo.mapper.SalaryLoginMapper;
import com.my.xl.salary.billdemo.pojo.SalaryLogin;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;


@Repository
public class LoginDao {
    @Resource
    private SalaryLoginMapper loginMapper;


    public SalaryLogin checkUserByUserId(String userId) {
         return loginMapper.checkUserByUserId(userId);
    }

    //注册账号
    public boolean addSakaryLogin(SalaryLogin s) {
        System.out.println(s.toString()+"<=====addSakaryLogin=====需要添加的数据");
        int insert = loginMapper.insert(s);
        return insert>0;
    }

    public boolean updateLoginPwd(SalaryLogin s) {
        System.out.println(s.toString()+"<=======updateLoginPwd===需要修改的数据");
        int up = loginMapper.updatePwdByUserId(s);
        //System.out.println("upupupupupupupupupupupup=updateLoginPwd==>"+up);
        return up>0;

    }

    //判断用户是否登陆过应用
    public List<String> isLoginByUser() {
        return  loginMapper.isLogin();
    }
}
